package com.healthmgmt.app.controller;

import com.healthmgmt.app.domain.Consultation;
import com.healthmgmt.app.service.IConsultationService;
import com.healthmgmt.common.core.controller.BaseController;
import com.healthmgmt.common.core.domain.AjaxResult;
import com.healthmgmt.common.core.page.TableDataInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 问题咨询管理Controller
 *
 * @author ruoyi
 * @date 2025-06-29
 */
@RestController
@RequestMapping("/app/consultation")
public class ConsultationController extends BaseController {

    @Resource
    private IConsultationService consultationService;

    /**
     * 查询问题咨询管理列表
     */
    @GetMapping("/list")
    public TableDataInfo list(Consultation consultation)
    {
        startPage();
        List<Consultation> list = consultationService.selectConsultationList(consultation);
        return getDataTable(list);
    }

    /**
     * 获取问题咨询管理详细信息
     */
    @GetMapping(value = "/{consultationId}")
    public AjaxResult getInfo(@PathVariable("consultationId") Long consultationId)
    {
        return success(consultationService.selectConsultationByConsultationId(consultationId));
    }

    /**
     * 新增问题咨询管理
     */
    @PostMapping
    public AjaxResult add(@RequestBody Consultation consultation)
    {
        return toAjax(consultationService.insertConsultation(consultation));
    }

    /**
     * 修改问题咨询管理
     */
    @PutMapping
    public AjaxResult edit(@RequestBody Consultation consultation)
    {
        return toAjax(consultationService.updateConsultation(consultation));
    }

    /**
     * 删除问题咨询管理
     */
    @DeleteMapping("/{consultationIds}")
    public AjaxResult remove(@PathVariable Long[] consultationIds)
    {
        return toAjax(consultationService.deleteConsultationByConsultationIds(consultationIds));
    }
}
